ÇöÀå¿¡¼ µé¾î¿À´Â Àü·ÂÀ» °¨½ÃÇÏ¿© ±âÁØÀÇ Àü·Â(ÇÇÅ©Ä¡ ±âÁØÁ¡)À» ÃÊ°úÇÏ¿´À» ¶§ ÀÌ °ªÀ» ±×·¡ÇÈ Ædzڿ¡ Ãâ·ÂÇÔ°ú µ¿½Ã¿¡ °æº¸¸¦ ¹ß»ý½Ãų ¼ö ÀÖ´Ù.
Àû¿ë : ÇöÀå¿¡¼ A-¹öÆ°À» ´©¸£°Ô µÇ¸é ÇÇÅ©Ä¡°¡ ÀÖ´Â °æ¿ì ±×·¡ÇÈ Ædzڿ¡ ÇÇÅ©Ä¡¸¦ Ãâ·ÂÇÏ°í, ÇÇÅ©Ä¡°¡ ¾ø´Â °æ¿ì¿¡´Â ÇöÀç°ªÀ» Ãâ·ÂÇØ ÁÖ¸éµÈ´Ù.
¶ÇÇÑ, B-¹öÆ°À» ´©¸£°Ô µÇ¸é ÇÇÅ©Ä¡¸¦ Reset ½ÃÄÑÁØ´Ù.
½ºÅ©¸³Æ®ÀÇ ºÎºÐÀ» 4ºÎºÐÀ¸·Î ³ª´«´Ù. (ÀÌ°ÍÀº »ç¿ëÀÚ°¡ ÆíÇÑ´ë·Î ±¸¼ºÇÏ´Â °ÍÀÌ ÁÁ´Ù.)
1) ÇÇÅ©Ä¡¸¦ °è»êÇÏ¿© ¾Æ³¯·Î±× ¸Þ¸ð¸® ű׿¡ ÀúÀå½ÃŲ´Ù.(ÁÖÀÇ : ¿©±â¼´Â ÇѼø°£¿¡ ÁöÁ¤ Àü·ÂÀ» ³Ñ¾úÀ» ¶§ ÇÇÅ©Ä¡·Î °£ÁÖÇÏÁö ¾Ê°í ÁöÁ¤Àü·ÂÀ» ¿¬¼ÓÇÏ¿© 10ºÐÀÌ»ó Áö¼ÓµÇ¾úÀ» ¶§¸¦ ÇÇÅ©Ä¡·Î °£ÁÖÇÑ´Ù. ±×¸®°í ÇöÀå¿¡¼ µé¾î¿À´Â Àü·ÂÀº 8°³¶ó°í °¡Á¤ÇÑ´Ù.)
Description, ÇÇÅ©Ä¡ °è»êÇϱâ,
ScanTime, 1,
Data, char, flag, 10,
Data, char, watttag, 20,
Data, char, peektag, 20,
Data, int, i, 1,
Data, double, wattvalue, 1,
Data, double, peekvalue, 1,
Data, char, alarmtag, 20,
Data, double, maxvalue, 10,
Data, int, count, 10,
Programm,
for(i=1; i<9 ; i=i+1){ // for¹®À» 8¹ø ¼öÇàÇÏ´Â ÀÌÀ¯´Â °¨½ÃÇØ¾ß ÇÒ Àü·ÂÀÌ 8±ºµ¥ À̱⠶§¹®ÀÌ´Ù.
@sprintf(watttag, "WATT%d",i); // WATT1 ~ WATT8¹ø±îÁö ½ÇÀü·ÂÀ» ¹Þ´Â ű×ÀÌ´Ù.
@sprintf(peektag, "PEEKW%d",i); // PEEK1 ~ PEEK8 ¹ø±îÁö ÇÇÅ©Ä¡¸¦ ÀúÀåÇÏ´Â ¾Æ³¯·Î±× ¸Þ¸ð¸® ű×ÀÌ´Ù.
@sprintf(alarmtag, "PEEKLAMP%d",i); // PEEKLAMP1 ~ PEEKLAMP8 ÇÇÅ©Ä¡°¡ ¹ß»ýÇÏ¿´À» °æ¿ì °æº¸¸¦ ³»º¸³»±â À§ÇÑ µðÁöÅÐ Ãâ·Â ű×
wattvalue = @GetTagValue(watttag);
peekvalue = @GetTagValue(peektag);
if (wattvalue >= $PEEKSET ){
count[i]=count[i]+1;
if(wattvalue < maxvalue[i]) return;
if(wattvalue >= maxvalue[i]){
maxvalue[i]=wattvalue;
if( count[i] >=600 ){ // ÀÌ ½ºÅ©¸³Æ®ÀÇ ScanTimeÀÌ 1ÃÊÀ̹ǷΠ60*10ºÐ= 600ÀÌ µÈ´Ù.
@SetTagValue(peektag,maxvalue[i]);
if( flag[i]== 0){
@ON(alarmtag);
flag[i]=1;
}
}
return;
}
}
else {
if( count[i] >= 600 ){
if(maxvalue[i] > peekvalue ){
@SetTagValue(peektag,maxvalue[i]);
@ON(alarmtag);
count[i]=0;
maxvalue[i]=0;
flag[i]=0;
}
else{
count[i]=0;
maxvalue[i]=0;
flag[i]=0;
}
}
else{
count[i]=0;
maxvalue[i]=0;
flag[i]=0;
}
}
}
2) A-¹öÆ°ÀÇ »óÅ°ªÀÌ OFFÀÏ ¶§´Â ÇöÀç°ªÀ» ±×·¡ÇÈ Ædzڿ¡ Ãâ·ÂÇÑ´Ù.
Description, A¹öÆ° OFF½Ã ÇöÀçÄ¡¸¦ º¸¿©ÁØ´Ù.,
ScanTime, 1,
Data, int, i, 1,
Data, char, watttag, 20,
Data, char, displaytag, 20,
Data, double, wattvalue, 1,
Data, double, oldwattvalue, 10,
Data, char, Abtflag, 1,
Programm,
if($DI_A_BT == 1 && Abtflag==0) return;
if($DI_A_BT == 0 && Abtflag==0){
Abtflag=1;
return;
}
if($DI_A_BT == 1 && Abtflag==1){
Abtflag=0;
for( i=1; i< 9; i=i+1){
oldwattvalue[i] = 0;
}
return;
}
if($DI_A_BT == 0 && Abtflag==1){
for( i=1; i< 9; i=i+1){
@sprintf(watttag, "WATT%d",i);
@sprintf(displaytag, "OUT%d",i);
wattvalue=@GetTagValue(watttag);
if(wattvalue == oldwattvalue[i]) return;
if(wattvalue != oldwattvalue[i]){
oldwattvalue[i] = wattvalue;
@SetTagValue(displaytag,wattvalue);
}
}
}
3) A-¹öÆ°ÀÇ »óÅ°ªÀÌ ON½Ã¿¡ ÇÇÅ©°ªÀÌ ÀÖ´Â °æ¿ì ÇÇÅ©°ªÀ» Ãâ·ÂÇÏ°í, ÇÇÅ©°ªÀÌ ¾ø´Â °æ¿ì ÇöÀç Àü·Â°ªÀ» º¸¿©ÁØ´Ù.
Description, A¹öÆ° ON½Ã ÇÇÅ©Ä¡/ÇöÀçÄ¡¸¦ º¸¿©ÁØ´Ù.,
ScanTime, 1,
Data, int, i, 1,
Data, char, watttag, 20,
Data, char, peektag, 20,
Data, char, displaytag, 20,
Data, double, wattvalue, 1,
Data, double, peekvalue, 1,
Data, char, flag, 10,
Data, double, oldwattvalue, 10,
Data, char, Abtflag, 1,
Programm,
if($DI_A_BT == 0 && Abtflag==0) return;
if($DI_A_BT == 1 && Abtflag==0){
Abtflag=1;
return;
}
if($DI_A_BT == 0 && Abtflag==1){
Abtflag=0;
for( i=1; i< 9; i=i+1){
oldwattvalue[i] = 0;
flag[i]=0;
}
return;
}
if($DI_A_BT == 1 && Abtflag==1){
for( i=1; i< 9; i=i+1){
@sprintf(watttag, "WATT%d",i);
@sprintf(peektag, "PEEKW%d",i);
@sprintf(displaytag, "OUT%d",i);
wattvalue=@GetTagValue(watttag);
peekvalue=@GetTagValue(peektag);
if(flag[i] == 1 ) return;
if(peekvalue != 0 ){
@SetTagValue(displaytag,peekvalue);
flag[i]=1;
return;
}
else{
if(wattvalue == oldwattvalue[i]) return;
if(wattvalue != oldwattvalue[i]){
oldwattvalue[i] = wattvalue;
@SetTagValue(displaytag,wattvalue);
}
}
}
}
4) B-¹öÆ° ON½Ã ÇÇÅ©°ªµéÀ» ResetÇÑ´Ù.
Description, ÇÇÅ©Ä¡¸¦ ¸®¼ÂÇØÁØ´Ù.,
ScanTime, 1,
Data, int, i, 1,
Data, char, buf, 20,
Programm,
if($DI_B_BT==0 ) return;
for(i=1; i< 9; i=i+1){
@sprintf(buf,"PEEKW%d",i);
@SetTagValue(buf, 0);
}
À§¿Í °°ÀÌ ÀÛ¼ºÀ» ÇÔÀ¸·Î½á ÇÇÅ©Ä¡¸¦ °è»êÇÒ ¼ö ÀÖÀ¸¸ç °è»êµÈ ÇÇÅ©Ä¡¸¦ ±×·¡ÇÈ Ædzؿ¡ Ãâ·ÂÇÒ ¼ö ÀÖ´Ù.